//
//  GQJIniViewController160818.m
//  TotalDemo
//
//  Created by gujian on 16/8/18.
//  Copyright © 2016年 gujian. All rights reserved.
//

#import "GQJIniViewController160818.h"

@interface GQJIniViewController160818 ()

@end

@implementation GQJIniViewController160818

/**
 *  1.线程安全与可重入
 *  2.线程安全一些概念
 *  3.参考资料  
 *  https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html
 *  https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaFundamentals/Introduction/Introduction.html#//apple_ref/doc/uid/TP40002974-CH1-SW1
 *  http://blog.csdn.net/wzzvictory/article/details/8630828
 *   Cocoa Drawing Guide
 */

- (void)viewDidLoad {
    [super viewDidLoad];
    
    __block NSMutableArray *arr;
    
    dispatch_queue_t customQueue = dispatch_queue_create("com.demo.gqj", DISPATCH_QUEUE_CONCURRENT);
    
    NSLog(@"beginTime:%f",[[NSDate date] timeIntervalSince1970]);
    
    dispatch_async(customQueue, ^{
        NSLog(@"thread:%@,time:%f",[NSThread currentThread],[[NSDate date] timeIntervalSince1970]);
        arr = [[NSMutableArray alloc] initWithObjects:@"1",@"2", nil];
    });
    
    dispatch_async(customQueue, ^{
        NSLog(@"thread:%@,time:%f",[NSThread currentThread],[[NSDate date] timeIntervalSince1970]);
        NSLog(@"arr count: %@", @([arr count]));
    });
    
}

- (void)content
{
    /**
     *
     */
}

@end
